home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / scilab / demos / npend / maple / ener.f < prev    next >
Text File  |  1999-09-16  |  4KB  |  124 lines

  1. c      
  2. c     SUBROUTINE ener
  3. c      
  4.       subroutine ener(th,e)
  5.         parameter (n=10)
  6.         implicit doubleprecision (t)
  7.         doubleprecision th(2*n),thd(n),et(1,1),r(n),j(n),m(n)
  8.         integer i 
  9.         data g / 9.81/
  10.         data r / n*1.0/
  11.         data m / n*1.0/
  12.         data j / n*0.3/
  13. c         
  14.         do 1000, i =1,n ,1
  15.           thd(i) = th(i+n)
  16.  1000   continue
  17. c       
  18.       t1 = thd(1)**2
  19.       t4 = thd(2)**2
  20.       t7 = thd(3)**2
  21.       t10 = thd(4)**2
  22.       t13 = thd(5)**2
  23.       t16 = thd(6)**2
  24.       t19 = thd(7)**2
  25.       t23 = thd(8)**2
  26.       t26 = thd(9)**2
  27.       t29 = thd(10)**2
  28.       t32 = sin(th(7))
  29.       t33 = r(7)*t32
  30.       t34 = 2*t33
  31.       t35 = sin(th(8))
  32.       t36 = r(8)*t35
  33.       t37 = 2*t36
  34.       t38 = sin(th(1))
  35.       t39 = r(1)*t38
  36.       t40 = 2*t39
  37.       t41 = sin(th(6))
  38.       t42 = r(6)*t41
  39.       t43 = 2*t42
  40.       t44 = sin(th(5))
  41.       t45 = r(5)*t44
  42.       t46 = 2*t45
  43.       t47 = sin(th(3))
  44.       t48 = r(3)*t47
  45.       t49 = 2*t48
  46.       t50 = sin(th(2))
  47.       t51 = r(2)*t50
  48.       t52 = 2*t51
  49.       t53 = sin(th(4))
  50.       t54 = r(4)*t53
  51.       t55 = 2*t54
  52.       t56 = sin(th(9))
  53.       t57 = r(9)*t56
  54.       t63 = -2*r(1)*t38*thd(1)
  55.       t65 = r(2)*t50*thd(2)
  56.       t68 = (t63-t65)**2
  57.       t69 = cos(th(1))
  58.       t72 = 2*r(1)*t69*thd(1)
  59.       t75 = r(2)*cos(th(2))*thd(2)
  60.       t77 = (t72+t75)**2
  61.       t84 = r(5)*t44*thd(5)
  62.       t85 = -2*t84
  63.       t87 = r(3)*t47*thd(3)
  64.       t88 = -2*t87
  65.       t89 = -2*t65
  66.       t91 = r(4)*t53*thd(4)
  67.       t92 = -2*t91
  68.       t94 = r(6)*t41*thd(6)
  69.       t97 = (t63+t85+t88+t89+t92-t94)**2
  70.       t100 = r(3)*cos(th(3))*thd(3)
  71.       t101 = 2*t100
  72.       t104 = r(4)*cos(th(4))*thd(4)
  73.       t105 = 2*t104
  74.       t106 = 2*t75
  75.       t109 = r(5)*cos(th(5))*thd(5)
  76.       t110 = 2*t109
  77.       t113 = r(6)*cos(th(6))*thd(6)
  78.       t115 = (t72+t101+t105+t106+t110+t113)**2
  79.       t119 = r(1)**2
  80.       t120 = t38**2
  81.       t123 = t69**2
  82.       t133 = (t63+t89-t87)**2
  83.       t135 = (t72+t106+t100)**2
  84.       t144 = (t88+t63+t89-t91)**2
  85.       t146 = (t101+t72+t106+t104)**2
  86.       t155 = (t63+t88+t89+t92-t84)**2
  87.       t157 = (t101+t105+t72+t106+t109)**2
  88.       t178 = sin(th(10))
  89.       t184 = r(7)*t32*thd(7)
  90.       t185 = -2*t184
  91.       t187 = r(9)*t56*thd(9)
  92.       t190 = r(8)*t35*thd(8)
  93.       t191 = -2*t190
  94.       t192 = -2*t94
  95.       t197 = (t185-2*t187+t191+t63+t192+t85+t88+t89+t92-r(10)*t178*thd(1
  96.      +0))**2
  97.       t200 = r(7)*cos(th(7))*thd(7)
  98.       t201 = 2*t200
  99.       t204 = r(9)*cos(th(9))*thd(9)
  100.       t208 = r(8)*cos(th(8))*thd(8)
  101.       t209 = 2*t208
  102.       t210 = 2*t113
  103.       t215 = (t201+2*t204+t209+t72+t210+t101+t105+t106+t110+r(10)*cos(th
  104.      +(10))*thd(10))**2
  105.       t221 = (t63+t192+t85+t88+t89+t92-t184)**2
  106.       t223 = (t72+t210+t101+t105+t106+t110+t200)**2
  107.       t229 = (t185+t191+t63+t192+t85+t88+t89+t92-t187)**2
  108.       t231 = (t201+t209+t72+t210+t101+t105+t106+t110+t204)**2
  109.       t237 = (t185+t63+t192+t85+t88+t89+t92-t190)**2
  110.       t239 = (t201+t72+t210+t101+t105+t106+t110+t208)**2
  111.          et(1,1) = J(4)*t10/2+J(3)*t7/2+J(6)*t16/2+J(5)*t13/2+J(8)*t23/2
  112.      ++J(7)*t19/2+J(9)*t26/2+J(10)*t29/2+m(10)*g*(t34+2*t57+t37+t40+t43+
  113.      +t46+t49+t52+t55+r(10)*t178)+m(8)*(t237+t239)/2+m(8)*g*(t34+t40+t43
  114.      ++t46+t49+t52+t55+t36)+m(7)*g*(t40+t43+t46+t49+t52+t55+t33)+m(2)*(t
  115.      +68+t77)/2+m(6)*(t97+t115)/2+m(1)*(t119*t120*t1+t119*t123*t1)/2+m(3
  116.      +)*(t133+t135)/2+m(4)*(t144+t146)/2+m(5)*(t155+t157)/2+m(4)*g*(t49+
  117.      +t40+t52+t54)+m(7)*(t221+t223)/2+m(10)*(t197+t215)/2+m(9)*(t229+t23
  118.      +1)/2+J(2)*t4/2+m(1)*g*t39+J(1)*t1/2+m(5)*g*(t40+t49+t52+t55+t45)+m
  119.      +(3)*g*(t40+t52+t48)+m(2)*g*(t40+t51)+m(9)*g*(t34+t37+t40+t43+t46+t
  120.      +49+t52+t55+t57)+m(6)*g*(t40+t46+t49+t52+t55+t42)
  121.         e = et(1,1)
  122.         return
  123.       end
  124.